package DMSXL._2023Before.String_;

/*public class repeatedSubstringPattern_ {
    public static void main(String[] args) {
        String haystack =  "abcabcabcabc";

        Solution solution = new Solution();
        System.out.println(solution.repeatedSubstringPattern(haystack));
    }
}
class Solution {
    public boolean repeatedSubstringPattern(String s) {
        if(s.length() == 0)
            return false;
        char[] str = s.toCharArray();

        for (int i = 0; i < str.length / 2; i++) {
            if(repeat(str,i+1))
                return true;
        }

        return false;
    }

    public boolean repeat(char[] str , int len){
        if(str.length % len != 0)
            return false;
        char[] son = new char[len];
        for (int i = 0; i < len; i++) {
            son[i] = str[i];
        }

        for (int i = len; i < str.length; i++) {
            if(str[i] == son[i %len])
                continue;
            else
                return false;
        }
        return true;
    }
}*/